<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<?php
$layout = explode('&&&', file_get_contents('layout.html'));
echo $layout[0];

session_start();
if (!(isset($_SESSION['username'])))
	header("location:login.php");
?>

<html>
<head>
<script language="JavaScript" src="calendar3.js"></script>
</head>
<body>
<div id="mainContent">
<script language=javascript type='text/javascript'>
function showVisibility(obj)
{
	if (obj.style.visibility == 'hidden')
	{
		obj.style.visibility = 'visible';
	}
	else
	{
		obj.style.visibility = 'hidden';
	}
}
function hideAll()
{
	document.getElementById('dateRange').style.display='none';
	document.getElementById('wTopic').style.display='none';
	document.getElementById('wLocation').style.display='none';
	document.getElementById('wLanguage').style.display='none';
	document.getElementById('cPartner').style.display='none';
	document.getElementById('prFirst').style.display='none';
	document.getElementById('prLast').style.display='none';
	document.getElementById('pFirst').style.display='none';
	document.getElementById('pLast').style.display='none';
	document.getElementById('pCity').style.display='none';
	document.getElementById('pType').style.display='none';
	document.getElementById('pLanguages').style.display='none';
	document.getElementById('pNewsletter').style.display='none';
	document.getElementById('pMembership').style.display='none';
	document.getElementById('oName').style.display='none';
}
function showWorkshop()
{
	document.getElementById('dateRange').style.display='';
	document.getElementById('wTopic').style.display='';
	document.getElementById('wLocation').style.display='';
	document.getElementById('wLanguage').style.display='';
	document.getElementById('cPartner').style.display='';
	document.getElementById('prFirst').style.display='';
	document.getElementById('prLast').style.display='';
}
function showParticipant()
{
	document.getElementById('dateRange').style.display='';
	document.getElementById('pFirst').style.display='';
	document.getElementById('pLast').style.display='';
	document.getElementById('pCity').style.display='';
	document.getElementById('pType').style.display='';
	document.getElementById('pLanguages').style.display='';
	document.getElementById('pNewsletter').style.display='';
	document.getElementById('pMembership').style.display='';
}
function showPresenter()
{
	document.getElementById('prFirst').style.display='';
	document.getElementById('prLast').style.display='';

}
function showOrganization()
{
	document.getElementById('oName').style.display='';
	document.getElementById('cPartner').style.display='';
}
function showNoChildren()
{
	document.getElementById('dateRange').style.display='';
}
function showLanguages()
{
	document.getElementById('dateRange').style.display='';
}
</script>

<b>Search for:</b><br>
<form  name="search" method="post" action="SearchResults.php">
    <p>
		<input name="SearchFor" type="radio" value="Workshop"	onclick="hideAll();showWorkshop();"> Workshops<br>
		<input name="SearchFor" type="radio" value="Participant" onclick="hideAll();showParticipant();"> Participants<br>
		<input name="SearchFor" type="radio" value="Presenter" onclick="hideAll();showPresenter();"> Presenters<br>
		<input name="SearchFor" type="radio" value="Organization" onclick="hideAll();showOrganization();"> Organizations<br>
		<input name="SearchFor" type="radio" value="NoChildren" onclick="hideAll();showNoChildren();"> # of Children<br>
		<input name="SearchFor" type="radio" value="LanguagesSpokenAtHome" onclick="hideAll();showLanguages();"> Languages Spoken at Home
	</p>

	<table width="576" border="2">
	<tr id="dateRange" style="display:none">
		<td width="226"><input name="6"type=checkbox onclick="showVisibility(getElementById('D1'));" />Choose a Date Range:</td>
        <td width="332">
        	<div id="D1" style="visibility:hidden;">
                	<label>
                        <input name="StartDate" type="text" size="15" maxlength="10"/>
                        <a href="javascript:cal.popup();"><img src="img/cal.gif" /></a> to
                        <input name="EndDate" type="text" size="15" maxlength="10" />
                        <a href="javascript:cal2.popup();"><img src="img/cal.gif" /></a>
                    </label>
			</div>
        </td>
	</tr>
    <tr id="wTopic" style="display:none">
		<td>
			<input name="1"type=checkbox onclick="showVisibility(getElementById('W1'));" />	Workshop Topic
        </td>
		<td>
       	<label>
				<select name="WorkshopTopic" id='W1' style="visibility:hidden;">
				<option value=""></option>
				<?php
                    $dbhost = 'localhost';
                    $dbuser = 'root';
                    $dbpass = '';
                    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
                    $dbname = "rtl" or die("Error Connecting to Database");
                    mysql_select_db($dbname);
                    $sql="select WRKSPTOPIC from workshoptopics";
                    $result=mysql_query($sql);
                    while($row=mysql_fetch_array($result))
                    {
				?>
				<option value="<?php echo $row['WRKSPTOPIC'] ?>"><?php echo $row['WRKSPTOPIC']; ?> </option>
				<?php } ?>
                </select>
			</label>
        </td>
	</tr>
	<tr id="wLocation" style="display:none">
		<td><input name="3"type=checkbox onclick="showVisibility(getElementById('W3'));" /> Location</td>
        <td>
			<label><input name="Location" type="text" id='W3' size="25" maxlength="65" style="visibility:hidden;" /></label>
		</td>
	</tr>
    <tr id="wLanguage" style="display:none">
		<td><input name="4"type=checkbox onclick="showVisibility(getElementById('W4'));" /> Workshop Language</td>
		<td>
        	<label>
				<select name="WorkshopLanguage" id='W4' style="visibility:hidden;">
				<option value=""></option>
				<?php
                    $dbhost = 'localhost';
                    $dbuser = 'root';
                    $dbpass = '';
                    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
                    $dbname = "rtl" or die("Error Connecting to Database");
                    mysql_select_db($dbname);
                    $sql="select LANG from language";
                    $result=mysql_query($sql);
                    while($row=mysql_fetch_array($result))
                    {
				?>
				<option value="<?php echo $row['LANG'] ?>"><?php echo $row['LANG']; ?> </option>
				<?php } ?>
                </select>
			</label>
		</td>
	</tr>
    <tr id="cPartner" style="display:none">
    	<td><input name="5"type=checkbox onclick="showVisibility(getElementById('W5'));" /> Community Partner: </td>
        <td>
        	<div id="W5" style="visibility:hidden;">
                  <input name="CommunityPartner" type="radio"value="Yes" />Yes
                  <input name="CommunityPartner" type="radio" value="No" />No
            </div>
		</td>
	</tr>
	<tr id="prFirst" style="display:none">
		<td><input name="7"type=checkbox onclick="showVisibility(getElementById('PR1'));" /> First Name(Presenter)</td>
        <td>
			<label>
            	<input name="PresenterFirst" type="text" size="25" id="PR1" maxlength="20" style="visibility:hidden;" />
            </label>
		</td>
	</tr>
    <tr id="prLast" style="display:none">
		<td><input name="8"type=checkbox onclick="showVisibility(getElementById('PR2'));" /> Last Name(Presenter)</td>
        <td>
			<label>
				<input name="PresenterLast" type="text" id="PR2" size="25" maxlength="20" style="visibility:hidden;" />
			</label>
		</td>
	</tr>
	<tr id="oName" style="display:none">
		<td><input name="9"type=checkbox onclick="showVisibility(getElementById('O1'));" /> Organization Name</td>
		<td>
			<label>
				<input name="OrganizationName" type="text" size="25" id="O1" maxlength="20" style="visibility:hidden;" />
			</label>
		</td>
	</tr>
	<tr id="pFirst" style="display:none">
		<td><input name="11"type=checkbox onclick="showVisibility(getElementById('P1'));" /> First Name</td>
		<td>
			<label>
                    <input name="FirstName" type="text" size="25" id="P1" maxlength="20" style="visibility:hidden;" />
        	</label>
        </td>
	</tr>
	<tr id="pLast" style="display:none">
		<td><input name="12"type=checkbox onclick="showVisibility(getElementById('P2'));" /> Last Name</td>
        <td>
        	<label>
                <input name="LastName" type="text" id="P2" size="25" maxlength="20" style="visibility:hidden;" />
            </label>
        </td>
	</tr>
	<tr id="pCity" style="display:none">
		<td><input name="13"type=checkbox onclick="showVisibility(getElementById('P3'));" /> City</td>
		<td>
			<label>
				<input name="City" type="text" id="P3" size="25" maxlength="20" style="visibility:hidden;" />
			</label>
		</td>
	</tr>
	<tr id="pType" style="display:none">
		<td><input name="14"type=checkbox onclick="showVisibility(getElementById('P4'));" /> Attended Workshop as:</td>
        <td>
			<label>
				<select name="ParticipantType" id="P4" style="visibility:hidden;">
				<br />
				<option value=""></option>
				<?php
					$dbhost = 'localhost';
                    $dbuser = 'root';
                    $dbpass = '';
                    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
                    $dbname = "rtl" or die("Error Connecting to Database");
                    mysql_select_db($dbname);
                    $sql="select t.TYPE from type t";
                    $result=mysql_query($sql);
                    while($row=mysql_fetch_array($result))
                    {
				?>
				<option value="<?php echo $row['TYPE'] ?>"><?php echo $row['TYPE']; ?> </option>
				<?php } ?>
                </select>
			</label>
		</td>
	</tr>
	<tr id="pLanguages" style="display:none">
		<td><input name="15"type=checkbox onclick="showVisibility(getElementById('P5'));" /> Languages Spoken in home:</td>
		<td>
			<label>
				<select name="pLanguage" id='P5' style="visibility:hidden;">
				<option value=""></option>
				<?php
                    $dbhost = 'localhost';
                    $dbuser = 'root';
                    $dbpass = '';
                    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
                    $dbname = "rtl" or die("Error Connecting to Database");
                    mysql_select_db($dbname);
                    $sql="select l.LANG from language l";
                    $result=mysql_query($sql);
                    while($row=mysql_fetch_array($result))
                    {
				?>
				<option value="<?php echo $row['LANG'] ?>"><?php echo $row['LANG']; ?> </option>
				<?php } ?>
                </select>
			</label>
		</td>
	</tr>
	<tr id="pNewsletter" style="display:none">
		<td><input name="16"type=checkbox onclick="showVisibility(getElementById('P6'));" /> Newsletter: </span></td>
		<td>
        	<div id="P6" style="visibility:hidden;">
        		<input name="Newsletter" type="radio" value="Yes" />Yes
                <input name="Newsletter" type="radio" value="No" />No
            </div>
		</td>
	</tr>
	<tr id="pMembership" style="display:none">
		<td><input name="17"type=checkbox onclick="showVisibility(getElementById('P7'));" /> Membership: </td>
        <td>
        	<div id="P7" style="visibility:hidden;">
        		<input name="Membership" type="radio" value="Yes" />Yes
                <input name="Membership" type="radio" value="No" />No
            </div>
        </td>
	</tr>
	</table>

<br>
<p>
  <input name="send" type="submit" id="send" value="Send!" class="button">
</p>
</form>

<script language="JavaScript">
	var cal = new calendar3(document.forms['search'].elements['StartDate']);
    var cal2 = new calendar3(document.forms['search'].elements['EndDate']);
</script>

</div>
<?php
echo $layout[1];
?>

</body>
</html>